3.4.17 \(\int \cos (c+d x) (a+a \sec (c+d x))^2 (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [317]

Optimal. Leaf size=82 \[ a^2 B x+\frac {a^2 (4 B+3 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a^2 (2 B+3 C) \tan (c+d x)}{2 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{2 d} \]

[Out]

a^2*B*x+1/2*a^2*(4*B+3*C)*arctanh(sin(d*x+c))/d+1/2*a^2*(2*B+3*C)*tan(d*x+c)/d+1/2*C*(a^2+a^2*sec(d*x+c))*tan(
d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {4157, 4002, 3999, 3852, 8, 3855} \begin {gather*} \frac {a^2 (2 B+3 C) \tan (c+d x)}{2 d}+\frac {a^2 (4 B+3 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 B x+\frac {C \tan (c+d x) \left (a^2 \sec (c+d x)+a^2\right )}{2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + a*Sec[c + d*x])^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

a^2*B*x + (a^2*(4*B + 3*C)*ArcTanh[Sin[c + d*x]])/(2*d) + (a^2*(2*B + 3*C)*Tan[c + d*x])/(2*d) + (C*(a^2 + a^2
*Sec[c + d*x])*Tan[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3999

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_)), x_Symbol] :> Simp[a*c*x, x]
 + (Dist[b*d, Int[Csc[e + f*x]^2, x], x] + Dist[b*c + a*d, Int[Csc[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e,
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 4002

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_)), x_Symbol] :> Simp[(-b)
*d*Cot[e + f*x]*((a + b*Csc[e + f*x])^(m - 1)/(f*m)), x] + Dist[1/m, Int[(a + b*Csc[e + f*x])^(m - 1)*Simp[a*c
*m + (b*c*m + a*d*(2*m - 1))*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] &&
GtQ[m, 1] && EqQ[a^2 - b^2, 0] && IntegerQ[2*m]

Rule 4157

Int[((a_.) + csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(
x_)]^2*(C_.))*((c_.) + csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.), x_Symbol] :> Dist[1/b^2, Int[(a + b*Csc[e + f*x])
^(m + 1)*(c + d*Csc[e + f*x])^n*(b*B - a*C + b*C*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps

\begin {align*} \int \cos (c+d x) (a+a \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\int (a+a \sec (c+d x))^2 (B+C \sec (c+d x)) \, dx\\ &=\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{2 d}+\frac {1}{2} \int (a+a \sec (c+d x)) (2 a B+a (2 B+3 C) \sec (c+d x)) \, dx\\ &=a^2 B x+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{2 d}+\frac {1}{2} \left (a^2 (2 B+3 C)\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (a^2 (4 B+3 C)\right ) \int \sec (c+d x) \, dx\\ &=a^2 B x+\frac {a^2 (4 B+3 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{2 d}-\frac {\left (a^2 (2 B+3 C)\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=a^2 B x+\frac {a^2 (4 B+3 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a^2 (2 B+3 C) \tan (c+d x)}{2 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(277\) vs. \(2(82)=164\).
time = 1.30, size = 277, normalized size = 3.38 \begin {gather*} \frac {1}{16} a^2 (1+\cos (c+d x))^2 \sec ^4\left (\frac {1}{2} (c+d x)\right ) \left (4 B x-\frac {2 (4 B+3 C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {2 (4 B+3 C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {C}{d \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 (B+2 C) \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}-\frac {C}{d \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 (B+2 C) \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + a*Sec[c + d*x])^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(a^2*(1 + Cos[c + d*x])^2*Sec[(c + d*x)/2]^4*(4*B*x - (2*(4*B + 3*C)*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]])
/d + (2*(4*B + 3*C)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]])/d + C/(d*(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^2
) + (4*(B + 2*C)*Sin[(d*x)/2])/(d*(Cos[c/2] - Sin[c/2])*(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])) - C/(d*(Cos[(c
+ d*x)/2] + Sin[(c + d*x)/2])^2) + (4*(B + 2*C)*Sin[(d*x)/2])/(d*(Cos[c/2] + Sin[c/2])*(Cos[(c + d*x)/2] + Sin
[(c + d*x)/2]))))/16

________________________________________________________________________________________

Maple [A]
time = 1.03, size = 114, normalized size = 1.39

method result size
derivativedivides \(\frac {a^{2} B \tan \left (d x +c \right )+a^{2} C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+2 a^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a^{2} C \tan \left (d x +c \right )+a^{2} B \left (d x +c \right )+a^{2} C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(114\)
default \(\frac {a^{2} B \tan \left (d x +c \right )+a^{2} C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+2 a^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a^{2} C \tan \left (d x +c \right )+a^{2} B \left (d x +c \right )+a^{2} C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(114\)
risch \(a^{2} B x -\frac {i a^{2} \left (C \,{\mathrm e}^{3 i \left (d x +c \right )}-2 B \,{\mathrm e}^{2 i \left (d x +c \right )}-4 C \,{\mathrm e}^{2 i \left (d x +c \right )}-C \,{\mathrm e}^{i \left (d x +c \right )}-2 B -4 C \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{2 d}+\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{2 d}\) \(172\)
norman \(\frac {a^{2} B x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {a^{2} \left (2 B +3 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a^{2} \left (2 B +5 C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-a^{2} B x +2 a^{2} B x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 a^{2} B x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {a^{2} \left (2 B +3 C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a^{2} \left (2 B +5 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {a^{2} \left (4 B +3 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {a^{2} \left (4 B +3 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(248\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*B*tan(d*x+c)+a^2*C*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d*x+c)+tan(d*x+c)))+2*a^2*B*ln(sec(d*x+c)+ta
n(d*x+c))+2*a^2*C*tan(d*x+c)+a^2*B*(d*x+c)+a^2*C*ln(sec(d*x+c)+tan(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 142, normalized size = 1.73 \begin {gather*} \frac {4 \, {\left (d x + c\right )} B a^{2} - C a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, C a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} \tan \left (d x + c\right ) + 8 \, C a^{2} \tan \left (d x + c\right )}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/4*(4*(d*x + c)*B*a^2 - C*a^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c)
 - 1)) + 4*B*a^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 2*C*a^2*(log(sin(d*x + c) + 1) - log(sin(d*
x + c) - 1)) + 4*B*a^2*tan(d*x + c) + 8*C*a^2*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 3.49, size = 119, normalized size = 1.45 \begin {gather*} \frac {4 \, B a^{2} d x \cos \left (d x + c\right )^{2} + {\left (4 \, B + 3 \, C\right )} a^{2} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (4 \, B + 3 \, C\right )} a^{2} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, {\left (B + 2 \, C\right )} a^{2} \cos \left (d x + c\right ) + C a^{2}\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/4*(4*B*a^2*d*x*cos(d*x + c)^2 + (4*B + 3*C)*a^2*cos(d*x + c)^2*log(sin(d*x + c) + 1) - (4*B + 3*C)*a^2*cos(d
*x + c)^2*log(-sin(d*x + c) + 1) + 2*(2*(B + 2*C)*a^2*cos(d*x + c) + C*a^2)*sin(d*x + c))/(d*cos(d*x + c)^2)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int B \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int 2 B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int B \cos {\left (c + d x \right )} \sec ^{3}{\left (c + d x \right )}\, dx + \int C \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int 2 C \cos {\left (c + d x \right )} \sec ^{3}{\left (c + d x \right )}\, dx + \int C \cos {\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))**2*(B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

a**2*(Integral(B*cos(c + d*x)*sec(c + d*x), x) + Integral(2*B*cos(c + d*x)*sec(c + d*x)**2, x) + Integral(B*co
s(c + d*x)*sec(c + d*x)**3, x) + Integral(C*cos(c + d*x)*sec(c + d*x)**2, x) + Integral(2*C*cos(c + d*x)*sec(c
 + d*x)**3, x) + Integral(C*cos(c + d*x)*sec(c + d*x)**4, x))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 154 vs. \(2 (76) = 152\).
time = 0.52, size = 154, normalized size = 1.88 \begin {gather*} \frac {2 \, {\left (d x + c\right )} B a^{2} + {\left (4 \, B a^{2} + 3 \, C a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (4 \, B a^{2} + 3 \, C a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 5 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(2*(d*x + c)*B*a^2 + (4*B*a^2 + 3*C*a^2)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - (4*B*a^2 + 3*C*a^2)*log(abs(
tan(1/2*d*x + 1/2*c) - 1)) - 2*(2*B*a^2*tan(1/2*d*x + 1/2*c)^3 + 3*C*a^2*tan(1/2*d*x + 1/2*c)^3 - 2*B*a^2*tan(
1/2*d*x + 1/2*c) - 5*C*a^2*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 - 1)^2)/d

________________________________________________________________________________________

Mupad [B]
time = 2.90, size = 162, normalized size = 1.98 \begin {gather*} \frac {2\,B\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {4\,B\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {3\,C\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {B\,a^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {2\,C\,a^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{2\,d\,{\cos \left (c+d\,x\right )}^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)*(B/cos(c + d*x) + C/cos(c + d*x)^2)*(a + a/cos(c + d*x))^2,x)

[Out]

(2*B*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (4*B*a^2*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)
))/d + (3*C*a^2*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (B*a^2*sin(c + d*x))/(d*cos(c + d*x)) + (2*C
*a^2*sin(c + d*x))/(d*cos(c + d*x)) + (C*a^2*sin(c + d*x))/(2*d*cos(c + d*x)^2)

________________________________________________________________________________________